package com.walley.jargongenerator.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;

public class JargonGenerator implements EntryPoint {

  private VerticalPanel mainPanel = new VerticalPanel();
  private FlexTable wordsFlexTable = new FlexTable();
  private HorizontalPanel addPanel = new HorizontalPanel();
  private TextBox newSymbolTextBox = new TextBox();
  private Button addWordsButton = new Button("Add");
  private Label lastUpdatedLabel = new Label();

  /**
   * Entry point method.
   */
  public void onModuleLoad() {
	    // Create table for words.
	    wordsFlexTable.setText(0, 0, "Verb");
	    wordsFlexTable.setText(0, 1, "Adjective");
	    wordsFlexTable.setText(0, 2, "Noun");
	    
	    // Assemble Add Word panel.
	    addPanel.add(newSymbolTextBox);
	    addPanel.add(addWordsButton);

	    // Assemble Main panel.
	    mainPanel.add(wordsFlexTable);
	    mainPanel.add(addPanel);
	    mainPanel.add(lastUpdatedLabel);	    
	    
	    // Associate the Main panel with the HTML host page.
	    RootPanel.get("wordList").add(mainPanel);
	    
    // TODO Move cursor focus to the input box.

  }

}